﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class kjxy_detail : System.Web.UI.Page
{
    protected string parent_name = string.Empty;
    protected string fourm_id;
    protected List<Forums> fs;
    protected void Page_Load(object sender, EventArgs e)
    {
        TreasurerDataContext db = new TreasurerDataContext();
        //if (!IsPostBack)
        //{ 
            //
            //获取文章id
            //
            string article_id = Request.QueryString["article_id"];
            var a = from aA in db.Articles where aA.ID.Equals(article_id) select aA;
            Repeater2.DataSource = a;
            Repeater2.DataBind();
            //
            //获取fourmId
            //
            fourm_id = a.First().ForumID;
            //
            //获取同级栏目
            //
            var p = from aP in db.Forums where aP.ID.Equals(fourm_id) select aP;
            if (p.First().ParentID == null)
            {
                parent_name = p.First().Name;
                //var t = from aT in db.Topic where aT.ID.Equals(fourm_id) select aT;
                fs = p.ToList<Forums>();
                //Repeater1.DataSource = p;
                //Repeater1.DataBind();
            }
            else
            {
                parent_name = (from aF in db.Forums where aF.ID.Equals(p.First().ParentID) select aF).First().Name;
                var t = from aT in db.Forums where aT.ParentID.Equals(p.First().ParentID) select aT;
                fs = t.ToList<Forums>();
                //Repeater1.DataSource = t;
                //Repeater1.DataBind();
            }
        //}
    }
}